import { ApiProperty } from '@midwayjs/swagger';
import { Rule, RuleType } from '@midwayjs/validate';

export class RainfallInfoDto {
  @ApiProperty({ example: '1', description: '位置精度级别', required: true })
  @Rule(RuleType.string().required())
  locationGranularity: string;

  @ApiProperty({ example: '100001', description: '降雨街道 ID', required: true })
  @Rule(RuleType.string().required())
  rainfallStreetId: string;

  @ApiProperty({ example: '50', description: '总降雨量', required: true })
  @Rule(RuleType.string().required())
  totalRainfall: string;

  @ApiProperty({ example: '3', description: '降雨持续时间(小时)', required: true })
  @Rule(RuleType.number().required())
  rainDuration: number;

  @ApiProperty({ example: '30', description: '最大降雨强度(毫米/小时)', required: true })
  @Rule(RuleType.string().required())
  maxRainIntensity: string;
}

export class CreateTaskDto {
  @ApiProperty({ example: '7939436c-d3df-4008-abdb-978ad79b0985', description: '任务 ID', required: true })
  @Rule(RuleType.string().required())
  taskId: string;

  @ApiProperty({ example: '2024-7-23 15:00:00', description: '降雨时间', required: true })
  @Rule(RuleType.string().required())
  resultTimestamp: string;

  @ApiProperty({ example: '10', description: '预测的时间范围(小时)', required: true })
  @Rule(RuleType.number().required())
  forecastRange: number;

  @ApiProperty({ type: [RainfallInfoDto], description: '降雨信息', required: true })
  @Rule(RuleType.array().items(RuleType.object()).required())
  rainfallInfo: RainfallInfoDto[];
}

export class uploadDto {
  @ApiProperty({ example: '7939436c-d3df-4008-abdb-978ad79b0985', description: '任务 ID', required: true })
  @Rule(RuleType.string().required())
  taskId: string;

  @ApiProperty({ example: '2024-7-23 15:00:00', description: '降雨时间', required: true })
  @Rule(RuleType.string().required())
  resultTimestamp: string;

  @ApiProperty({ example: '10', description: '预测的时间范围(小时)', required: true })
  @Rule(RuleType.number().required())
  forecastRange: number;

}